﻿using System.ComponentModel;
using CSW.Framework.Common;

namespace LinqBusinessObjectBuilder.ProjectInfo
{
    internal class AuthenticationMode
    {
        private static readonly AuthenticationMode m_WindowsAuthentication;
        private static readonly AuthenticationMode m_SqlServerAuthentication;
        private static readonly ReadOnlyBindingList<AuthenticationMode> m_List;

        private readonly string m_Name;

        static AuthenticationMode()
        {
            m_WindowsAuthentication = new AuthenticationMode("Windows Authentication");
            m_SqlServerAuthentication = new AuthenticationMode("SQL Server Authentication");

            m_List = new ReadOnlyBindingList<AuthenticationMode>
                         {
                             m_WindowsAuthentication, 
                             m_SqlServerAuthentication
                         };

            m_List.MakeReadOnly();
        }

        private AuthenticationMode(string name)
        {
            Guard.ArgumentNotNullOrEmptyString(name, "name");

            m_Name = name;
        }

        public string Name
        {
            get { return m_Name; }
        }

        public override string ToString()
        {
            return m_Name;
        }

        public static AuthenticationMode WindowsAuthentication
        {
            get { return m_WindowsAuthentication; }
        }

        public static AuthenticationMode SqlServerAuthentication
        {
            get { return m_SqlServerAuthentication; }
        }

        public static BindingList<AuthenticationMode> GetAll()
        {
            return m_List;
        }
    }
}